<template>
  <div style="display:inline-block; width: 100%;">
    <el-input
      v-bind="$attrs"
      readonly
      clearable
      placeholder="请选择用户"
      v-on="$listeners">
      <el-button slot="append" icon="el-icon-search" @click="selectUser" />
    </el-input>
    <userSelectList ref="userSelectList" :multi_select="multiSelect" @userSelectCallback="callback" />
  </div>
</template>

<script>
import userSelectList from '@/views/system/user/module/userSelectList'

export default {
  components: { userSelectList },
  props: {
    multiSelect: {
      type: Boolean,
      default: true,
      required: false
    }
  },
  data() {
    return {
    }
  },
  mounted() {
  },
  methods: {
    selectUser() {
      const _this = this.$refs.userSelectList
      _this.init()
      _this.dialog = true
    },
    callback(selectedRow, userSelectObj) {
      this.$emit('userSelectCallback', selectedRow, userSelectObj)
      userSelectObj.cancel()
      userSelectObj.loading = false
    }
  }
}
</script>
